package com.clt.ess.CABeen;

import java.io.Serializable;
import java.util.List;

//证书延期请求客户端请求参数（同步）
public class DelaySealCertRequest implements Serializable {
    //业务类型 delaySealCert
    //必须
    private String taskCode;
    //协议版本号 1.0
    //必须
    private String version;
    //客户端随机数（RandomA）与服务端随机数（RandomB）字符串拼接，中间无分割符号
    //必须
    private String tokenInfo;
    //任务编号类
    //必须
    private List<DelaySealCertRequestData> data;
    //签名信息
    //必须
    private SignInfo signInfo;

    /**
     {
         "taskCode ": "delaySealCert",
         " version": "1.0",
         "tokenInfo": "RandomA+RandomB",
         "data ": [{
             "requestID ": "0 ",
             "serialNumber ": "签名证书序列号 ",
             "subjectPublicKeyInfo ": "base64编码的公钥 "
         }],
         "signInfo": {
             "signAlgorithm ": "1.2 .156 .10197 .1 .501 ",
             " signValue ": " base64 编码的签名值"
         }
     }
     */

    public DelaySealCertRequest() {
    }

    public DelaySealCertRequest(String taskCode, String version, String tokenInfo, List<DelaySealCertRequestData> data, SignInfo signInfo) {
        this.taskCode = taskCode;
        this.version = version;
        this.tokenInfo = tokenInfo;
        this.data = data;
        this.signInfo = signInfo;
    }

    public String getTaskCode() {
        return taskCode;
    }

    public void setTaskCode(String taskCode) {
        this.taskCode = taskCode;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getTokenInfo() {
        return tokenInfo;
    }

    public void setTokenInfo(String tokenInfo) {
        this.tokenInfo = tokenInfo;
    }

    public List<DelaySealCertRequestData> getData() {
        return data;
    }

    public void setData(List<DelaySealCertRequestData> data) {
        this.data = data;
    }

    public SignInfo getSignInfo() {
        return signInfo;
    }

    public void setSignInfo(SignInfo signInfo) {
        this.signInfo = signInfo;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"taskCode\":\"")
                .append(taskCode).append('\"');
        sb.append(",\"version\":\"")
                .append(version).append('\"');
        sb.append(",\"tokenInfo\":\"")
                .append(tokenInfo).append('\"');
        sb.append(",\"data\":")
                .append(data);
        if(signInfo!=null && signInfo.getSignValue()!=null && !"".equals(signInfo.getSignValue())){
            sb.append(",\"signInfo\":")
                    .append(signInfo);
        }
        sb.append('}');
        return sb.toString();
    }
}
